import scrapy


class NewsSpider(scrapy.Spider):
    name = "news"
    allowed_domains = ["www.news.cn"]
    start_urls = ["https://so.news.cn"]

    def start_requests(self):
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
            'Referer': 'https://www.news.cn/',
        }
        for url in self.start_urls:
            yield scrapy.Request(url, headers=headers, callback=self.parse)

    def parse(self, response):
        print(response)
